<?php
	$starttime = microtime();
	
	
	
		include_once "simple_html_dom.php";



function calculateEqTemp()
{
	
}
function printMain()
{
include("../wetterIncludes/unwetterzentrale.inc.php");
include("../wetterIncludes/unimuensterwetter.inc.php");
include("../wetterIncludes/wetteronline.inc.php");
    ?>

    <div id="header">
    <img src="images/wetter_logo.gif" />
    </div>
    
<br />
    <div id="quadrat">
    <table border="0">
    <tr>
    <td><img src="images/temp.png" alt="Picture" /></td>
    <td>   <? if (!$error) {?> <div class="largefont"><strong>Aktuell <?
        echo $unimuensterdaten;?></strong><?
    } else echo "<span style='color:red'>Die Daten der Uni M&uuml;nster sind &auml;lter als eine Stunde. Verarbeite alternative Messdaten von Meteomedia. </span></strong>"?>
    
    <? if (!$error) echo"</div>"; ?><td>
    </tr>
    </table>
    </div>
    
    <h1>Vorhersage:</h1>
    
    <div id="quadrat">
    
    <?
    
    $wetteronline = str_get_html($article);

    
$e = $wetteronline->find("td", 0);
$e -> outertext ='';

$e = $wetteronline->find("td", 4);
$e -> outertext ='';

$e = $wetteronline->find("td", 8);
$e -> outertext ='';

$e = $wetteronline->find("td", 12);
$e -> outertext ='';

$e = $wetteronline->find("td", 16);
$e -> outertext ='';

$e = $wetteronline->find("td", 20);
$e -> outertext ='';

$e = $wetteronline->find("td", 24);
$e -> outertext ='';

       
 echo utf8_encode($wetteronline); ?>
    </div>
    
  
    
    <h1>Messdaten</h1>
          <div id="quadrat">
    <?php
    if ($error) {
        echo "<img src=\"http://wetterstationen.meteomedia.de/messnetz/wettergrafik/103130.png\" />";
    }
    else
    {
    ?>

    <b>Gemessen:</b> <? echo "Vor ". $diff/60 . " Minuten";
    ?><br />
    <b>Windst&auml;rke:</b> <? echo $item[4] . "<br />";
    ?>
    <?php //print_r($nowcast); ?>
   
    <b>Sonnenaufgang:</b> <?echo    date_sunrise(time(), SUNFUNCS_RET_STRING, 51.5658, 7.3613, 90, 1),    " <br />";
    ?>
    <b>Sonnenuntergang:</b> <?echo     date_sunset(time(), SUNFUNCS_RET_STRING, 51.5658, 7.3613, 90, 1),    " <br />";
        include "../wetterIncludes/schnee.php" ;
    }
    ?>
    

    

    
    </div>

    
    		       <h1>Regenradar</h1>
    		       
    		       <?php
$wetterSource = file_get_contents('http://www.wetter.com/deutschland/muenster/DE0006530.html');

preg_match_all("([0-9]{12}\.gif)", $wetterSource, $treffer, PREG_SET_ORDER);

?>

    						  
	<div style="height:154px; width:184px;position: relative;"  >
<div style="position: absolute; top: 0px; left: 0px; display: block;" name="cities.png">
<img height="154" width="184" src="http://maps-2.wetter.com/maps/EU/DE/NW/1/s/anim_radar_90_<?php echo $treffer[0][0];?>">
</div>

<div style="position: absolute; top: 0px; left: 0px; display: block;" name="cities.png">
<img height="154" width="184" src="http://maps-2.wetter.com/maps/EU/DE/NW/1/s/cities.png">
</div>

<div style="position: absolute; top: 0px; left: 0px; display: block;" name="states.png"><img height="154" width="184" src="http://maps-2.wetter.com/maps/EU/DE/NW/1/s/states.png"></div>
</div>


     
      <h1>Vorhersagediagramm</h1>
    						  
					    <div id="wrapper">
	<div id="scroller">
	<img src="http://www.krystof.eu/m/diagramm.php" border="0">&nbsp;
 	</div>
</div>

<?
$unwetterDOM = str_get_html($warnungen);

	foreach($unwetterDOM->find('div[style]') as $div) {
   $div->style='padding-top:10px;';
	}
	

            foreach($unwetterDOM->find('img') as $img) 
       {
$img -> outertext ='';
       }
       
       	$unwetterDOM = str_replace("span", "div",$unwetterDOM );

       
?>
					
    						              <div id="quadrat">
<? echo $unwetterDOM; ?></div>
					    <div><img src="nrwmap.php" width="310" height="310" border="0"></div>
		     
    <?
}



$authenticated = false;
$password = 'schalke05';
$cookie_name = 'auth';
error_reporting(E_ALL);
ini_set("display_errors", 1);
$cookie_time = (3600 * 24 * 30); // 30 days

if(isSet($_POST['submit']))
{
	$post_password = trim($_POST['password']);
	if ( $post_password == $password)
	{
		$authenticated = true;
		$password_hash = md5($password);
		setcookie ($cookie_name, $password_hash, time() + $cookie_time);
	}
}

?>
<!doctype html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>M&uuml;nster Wetter</title>
        <link rel="stylesheet" href="images/mobile.css" type="text/css" />
        <link rel="apple-touch-icon" href="/m/mswetter.png" />
        <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0" />
        <script type="text/javascript" src="iscroll.js"></script>
                      
     </head>
    <body onload="myScroll = new iScroll('scroller', {vScrollBar: false, hScrollBar: true});animation();" >


        <?php

		printMain();



?>

    </body>
</html>